//****************************************************************************************************************
// Filename: thumbnails.h
// header for ThumnailsDoc class
// inherit form QList Widget
// use to display thumbnail list in TES
// data March 2012
//****************************************************************************************************************
#ifndef THUMBNAILS_H
#define THUMBNAILS_H
#include <QListWidget>
#include <QLabel>
#include <QLineF>
#include <QPointF>
#include <QMouseEvent>


class ThumbnailsDock : public QListWidget {
    Q_OBJECT

public:
    ThumbnailsDock(QWidget *parent = 0);
    ~ThumbnailsDock();
    // function to init
    // take a qvector of page image
    // will put each image to thumbnail
    // add placed on the QListWidget
    void initDoc(QVector<QImage> p);
    // gevt distance data back
    double getDistance();
   
    public slots:
    //slot to start Test
    void beginTest();

    //slot to stop test
    void abortTest();

  protected:
    // function that handle mouse move event
    // keep tracking move distance
    void mouseMoveEvent(QMouseEvent *);
    // even Filter to set filter for mouse move evnt
    bool eventFilter(QObject *obj, QEvent *event);
    
    private slots:
    // handle QListWidget item signal
    // emit a page clicked signal
    void pageClickHandler(QListWidgetItem * item);
  signals:
    void pageClicked(int currentPage);
  private:
    int thumbWidth;
    int thumbHeight;

    // following varibales are used for get testing data
    double travelDistance;
    bool startTest;
    QPointF last;
    int targetPage;
    int targetClickTimes;
};

#endif

